#!/bin/bash

if [ -d "target/" ]; then
    rm -rf target/
fi

mkdir target;
mkdir target/lib/
mkdir target/bin/

cd formDataParse/src;
make  clean
make  
cp ../target/lib/libFormDataParse.so ../../target/lib/
cd -

# fasterjson output: /root/lib/libfasterjson.so and  /root/include/fasterjson/fasterjson.h
cd fasterjson/src;
make -f makefile.Linux clean
make -f makefile.Linux 
cp libfasterjson.so ../../target/lib/
cd -

# tcpdaemon output: /root/lib/libtcpdaemon.a and  /root/include/fasterjson/tcpdaemon.h
cd tcpdaemon/src;
make -f makefile.Linux clean
make -f makefile.Linux 
cp libtcpdaemon.a ../../target/lib/
cd -

# fasterhttp output: /root/lib/libfasterhttp.so and  /root/include/fasterjson/fasterhttp.h
cd fasterhttp/src;
make -f makefile.Linux clean
make -f makefile.Linux  
cp libfasterhttp.so ../../target/lib/
cd -

# restserver output: /root/so/RS_decode_frames_ctl.so and  /root/bin/restserver
cd restserver/src;
make -f makefile.Linux clean
make -f makefile.Linux 
cp librestserver_api.so ../../target/lib/
cp restserver ../../target/bin/
cd -

cd restserver/example/hello;
make -f makefile.Linux clean
make -f makefile.Linux 
cp RS_hello.so ../../../target/lib/
cp restserver.conf ../../../target/bin/
cd -

